//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2022 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if compiler(>=5.5.2) && canImport(_Concurrency)

import SotoCore

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension CodeGuruProfiler {
    // MARK: Async API Calls

    /// Add up to 2 anomaly notifications channels for a profiling group.
    public func addNotificationChannels(_ input: AddNotificationChannelsRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> AddNotificationChannelsResponse {
        return try await self.client.execute(operation: "AddNotificationChannels", path: "/profilingGroups/{profilingGroupName}/notificationConfiguration", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Returns the time series of values for a requested list  of frame metrics from a time period.
    public func batchGetFrameMetricData(_ input: BatchGetFrameMetricDataRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> BatchGetFrameMetricDataResponse {
        return try await self.client.execute(operation: "BatchGetFrameMetricData", path: "/profilingGroups/{profilingGroupName}/frames/-/metrics", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Used by profiler agents to report their current state and to receive remote  configuration updates. For example, ConfigureAgent can be used  to tell an agent whether to profile or not and for how long to return profiling data.
    public func configureAgent(_ input: ConfigureAgentRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ConfigureAgentResponse {
        return try await self.client.execute(operation: "ConfigureAgent", path: "/profilingGroups/{profilingGroupName}/configureAgent", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Creates a profiling group.
    public func createProfilingGroup(_ input: CreateProfilingGroupRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CreateProfilingGroupResponse {
        return try await self.client.execute(operation: "CreateProfilingGroup", path: "/profilingGroups", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Deletes a profiling group.
    public func deleteProfilingGroup(_ input: DeleteProfilingGroupRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> DeleteProfilingGroupResponse {
        return try await self.client.execute(operation: "DeleteProfilingGroup", path: "/profilingGroups/{profilingGroupName}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Returns a  ProfilingGroupDescription  object that contains information about the requested profiling group.
    public func describeProfilingGroup(_ input: DescribeProfilingGroupRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> DescribeProfilingGroupResponse {
        return try await self.client.execute(operation: "DescribeProfilingGroup", path: "/profilingGroups/{profilingGroupName}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Returns a list of   FindingsReportSummary  objects that contain analysis results for all profiling groups in your AWS account.
    public func getFindingsReportAccountSummary(_ input: GetFindingsReportAccountSummaryRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetFindingsReportAccountSummaryResponse {
        return try await self.client.execute(operation: "GetFindingsReportAccountSummary", path: "/internal/findingsReports", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Get the current configuration for anomaly notifications for a profiling group.
    public func getNotificationConfiguration(_ input: GetNotificationConfigurationRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetNotificationConfigurationResponse {
        return try await self.client.execute(operation: "GetNotificationConfiguration", path: "/profilingGroups/{profilingGroupName}/notificationConfiguration", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Returns the JSON-formatted resource-based policy on a profiling group.
    public func getPolicy(_ input: GetPolicyRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetPolicyResponse {
        return try await self.client.execute(operation: "GetPolicy", path: "/profilingGroups/{profilingGroupName}/policy", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Gets the aggregated profile of a profiling group for a specified time range.  Amazon CodeGuru Profiler collects posted agent profiles for a profiling group  into aggregated profiles.       Because aggregated profiles expire over time GetProfile is not idempotent.     Specify the time range for the requested aggregated profile using 1 or 2 of the following parameters: startTime,  endTime, period. The maximum time range allowed is 7 days. If you specify all 3 parameters,  an exception is thrown. If you specify only period, the latest aggregated profile is returned.     Aggregated profiles are available with aggregation periods of 5 minutes, 1 hour, and 1 day, aligned to  UTC. The aggregation period of an aggregated profile determines how long it is retained. For more  information, see  AggregatedProfileTime . The aggregated profile's aggregation period determines how long   it is retained by CodeGuru Profiler.      If the aggregation period is 5 minutes, the aggregated profile is retained for 15 days.     If the aggregation period is 1 hour, the aggregated profile is retained for 60 days.     If the aggregation period is 1 day, the aggregated profile is retained for 3 years.     There are two use cases for calling GetProfile.    If you want to return an aggregated profile that already exists, use   ListProfileTimes to  view the time ranges of existing aggregated profiles. Use them in a GetProfile request to return a specific,  existing aggregated profile.     If you want to return an aggregated profile for a time range that doesn't align with an existing aggregated profile,  then CodeGuru Profiler makes a best effort to combine existing aggregated profiles from the requested time  range and return them as one aggregated profile.    If aggregated profiles do not exist for the full time range requested, then aggregated profiles for a smaller time range are returned. For example, if the requested time range is from 00:00 to 00:20, and the existing aggregated profiles are from 00:15 and 00:25, then the aggregated profiles from 00:15 to 00:20 are returned.
    public func getProfile(_ input: GetProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetProfileResponse {
        return try await self.client.execute(operation: "GetProfile", path: "/profilingGroups/{profilingGroupName}/profile", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Returns a list of   Recommendation  objects that contain recommendations for a profiling group for a given time period. A list of   Anomaly  objects that contains details about anomalies detected in the profiling group for the same time period is also  returned.
    public func getRecommendations(_ input: GetRecommendationsRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> GetRecommendationsResponse {
        return try await self.client.execute(operation: "GetRecommendations", path: "/internal/profilingGroups/{profilingGroupName}/recommendations", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// List the available reports for a given profiling group and time range.
    public func listFindingsReports(_ input: ListFindingsReportsRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListFindingsReportsResponse {
        return try await self.client.execute(operation: "ListFindingsReports", path: "/internal/profilingGroups/{profilingGroupName}/findingsReports", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Lists the start times of the available aggregated profiles of a profiling group  for an aggregation period within the specified time range.
    public func listProfileTimes(_ input: ListProfileTimesRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListProfileTimesResponse {
        return try await self.client.execute(operation: "ListProfileTimes", path: "/profilingGroups/{profilingGroupName}/profileTimes", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Returns a list of profiling groups. The profiling groups are returned as   ProfilingGroupDescription  objects.
    public func listProfilingGroups(_ input: ListProfilingGroupsRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListProfilingGroupsResponse {
        return try await self.client.execute(operation: "ListProfilingGroups", path: "/profilingGroups", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Returns a list of the tags that are assigned to a specified resource.
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListTagsForResourceResponse {
        return try await self.client.execute(operation: "ListTagsForResource", path: "/tags/{resourceArn}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Submits profiling data to an aggregated profile of a profiling group. To get an   aggregated profile that is created with this profiling data, use   GetProfile .
    public func postAgentProfile(_ input: PostAgentProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> PostAgentProfileResponse {
        return try await self.client.execute(operation: "PostAgentProfile", path: "/profilingGroups/{profilingGroupName}/agentProfile", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Adds permissions to a profiling group's resource-based policy  that are provided using an action group. If a profiling group doesn't have  a resource-based policy, one is created for it using the permissions in the action group and  the roles and users in the principals parameter.   The one supported action group that can be added is agentPermission which grants ConfigureAgent and PostAgent permissions. For more information, see Resource-based policies in CodeGuru Profiler in the Amazon CodeGuru Profiler User Guide,  ConfigureAgent , and  PostAgentProfile .    The first time you call PutPermission on a profiling group, do not specify a revisionId because  it doesn't have a resource-based policy. Subsequent calls must provide a revisionId to specify  which revision of the resource-based policy to add the permissions to.    The response contains the profiling group's JSON-formatted resource policy.
    public func putPermission(_ input: PutPermissionRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> PutPermissionResponse {
        return try await self.client.execute(operation: "PutPermission", path: "/profilingGroups/{profilingGroupName}/policy/{actionGroup}", httpMethod: .PUT, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Remove one anomaly notifications channel for a profiling group.
    public func removeNotificationChannel(_ input: RemoveNotificationChannelRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> RemoveNotificationChannelResponse {
        return try await self.client.execute(operation: "RemoveNotificationChannel", path: "/profilingGroups/{profilingGroupName}/notificationConfiguration/{channelId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Removes permissions from a profiling group's resource-based policy that are provided using an action group. The one supported action group that can be removed is agentPermission which grants ConfigureAgent and PostAgent permissions. For more information, see Resource-based policies in CodeGuru Profiler in the Amazon CodeGuru Profiler User Guide,  ConfigureAgent , and  PostAgentProfile .
    public func removePermission(_ input: RemovePermissionRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> RemovePermissionResponse {
        return try await self.client.execute(operation: "RemovePermission", path: "/profilingGroups/{profilingGroupName}/policy/{actionGroup}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Sends feedback to CodeGuru Profiler about whether the anomaly detected by the analysis is  useful or not.
    public func submitFeedback(_ input: SubmitFeedbackRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> SubmitFeedbackResponse {
        return try await self.client.execute(operation: "SubmitFeedback", path: "/internal/profilingGroups/{profilingGroupName}/anomalies/{anomalyInstanceId}/feedback", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Use to assign one or more tags to a resource.
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TagResourceResponse {
        return try await self.client.execute(operation: "TagResource", path: "/tags/{resourceArn}", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    ///  Use to remove one or more tags from a resource.
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> UntagResourceResponse {
        return try await self.client.execute(operation: "UntagResource", path: "/tags/{resourceArn}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Updates a profiling group.
    public func updateProfilingGroup(_ input: UpdateProfilingGroupRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> UpdateProfilingGroupResponse {
        return try await self.client.execute(operation: "UpdateProfilingGroup", path: "/profilingGroups/{profilingGroupName}", httpMethod: .PUT, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension CodeGuruProfiler {
    ///   Returns a list of   FindingsReportSummary  objects that contain analysis results for all profiling groups in your AWS account.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func getFindingsReportAccountSummaryPaginator(
        _ input: GetFindingsReportAccountSummaryRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<GetFindingsReportAccountSummaryRequest, GetFindingsReportAccountSummaryResponse> {
        return .init(
            input: input,
            command: self.getFindingsReportAccountSummary,
            inputKey: \GetFindingsReportAccountSummaryRequest.nextToken,
            outputKey: \GetFindingsReportAccountSummaryResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  List the available reports for a given profiling group and time range.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listFindingsReportsPaginator(
        _ input: ListFindingsReportsRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListFindingsReportsRequest, ListFindingsReportsResponse> {
        return .init(
            input: input,
            command: self.listFindingsReports,
            inputKey: \ListFindingsReportsRequest.nextToken,
            outputKey: \ListFindingsReportsResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Lists the start times of the available aggregated profiles of a profiling group  for an aggregation period within the specified time range.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listProfileTimesPaginator(
        _ input: ListProfileTimesRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListProfileTimesRequest, ListProfileTimesResponse> {
        return .init(
            input: input,
            command: self.listProfileTimes,
            inputKey: \ListProfileTimesRequest.nextToken,
            outputKey: \ListProfileTimesResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///   Returns a list of profiling groups. The profiling groups are returned as   ProfilingGroupDescription  objects.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listProfilingGroupsPaginator(
        _ input: ListProfilingGroupsRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListProfilingGroupsRequest, ListProfilingGroupsResponse> {
        return .init(
            input: input,
            command: self.listProfilingGroups,
            inputKey: \ListProfilingGroupsRequest.nextToken,
            outputKey: \ListProfilingGroupsResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }
}

#endif // compiler(>=5.5.2) && canImport(_Concurrency)
